﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using System.Windows.Controls;

namespace SharePointOptimizer.PL.WPF
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            EventManager.RegisterClassHandler(typeof(TextBox),
                  TextBox.GotFocusEvent,
                  new RoutedEventHandler(TextBox_GotFocus));
            base.OnStartup(e);

           EventManager.RegisterClassHandler(typeof(TextBox),
           TextBox.GotMouseCaptureEvent,
           new RoutedEventHandler(TextBox_GotMouseCapture));
          
            EventManager.RegisterClassHandler(typeof(TextBox),
         TextBox.PreviewMouseUpEvent,
         new RoutedEventHandler(TextBox_PreviewMouseUpEvent));
        
        
        }
        void TextBox_PreviewMouseUpEvent(object sender, RoutedEventArgs e)
        {
            (sender as TextBox).SelectAll();
            (sender as TextBox).ReleaseMouseCapture();
            e.Handled = true;
                    
        }
        void TextBox_GotFocus(object sender, RoutedEventArgs e)
        {
            (sender as TextBox).SelectAll();
             
        }

        void TextBox_GotMouseCapture(object sender, RoutedEventArgs e)
        {
            
            (sender as TextBox).SelectAll();
        } 
    
    }
}
